Skip to content

tests: add load tests to the cache ingestion and simulation loop#236

Open
dylanlott wants to merge 2 commits intodylan/sim-testsfrom
dylan/load-test-bundle-sim
Open

tests: add load tests to the cache ingestion and simulation loop#236
dylanlott wants to merge 2 commits intodylan/sim-testsfrom
dylan/load-test-bundle-sim

Conversation

@dylanlott
Copy link
Contributor

@dylanlott dylanlott commented Mar 4, 2026

tests: add load tests to the cache ingestion and simulation loop

Per discussions with @Fraser999 I load tested the builder simulation loop and was able to reproduce the same error they saw - the build function deadlocks over some limit of bundles, which also prevents the simulation deadline from being respected.

image.png

The screenshot shows the test running and taking over 60 seconds, but with the deadline configured for 12 seconds, which should terminate the build loop and return a block with tx_count > 0.

Copy link
Contributor Author

dylanlott commented Mar 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@dylanlott dylanlott force-pushed the dylan/load-test-bundle-sim branch from 7697e42 to d99e2c8 Compare March 4, 2026 01:06
Copy link
Contributor Author

The 50k test won't pass so this PR shouldn't be merged until the simulation deadlock issue is resolved.

@dylanlott dylanlott force-pushed the dylan/load-test-bundle-sim branch from acec1af to def269d Compare March 11, 2026 01:46
Copy link
Contributor Author

I thought the deadlock issue would solve the 50k test, but it still fails, but not sure what the root cause is yet.

- every bundle had the same effective fee score, so cache insertion hit heavy rank collision
@dylanlott dylanlott force-pushed the dylan/load-test-bundle-sim branch from ba26c1a to edbd58d Compare March 11, 2026 06:11
@dylanlott dylanlott marked this pull request as ready for review March 11, 2026 06:12
Copy link
Contributor Author

Update: It wasn't a deadlock, it was a very long running test from a runtime blow up. The blow up was caused by a priority fee collision at insertion time. After assigning different priority fees, tests pass.

/// 50k bundles each containing 1 transfer tx. Verify block builds with non-zero count of included txs.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_load_50k_bundles() {
let count = 50_000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth dropping this to 5k, since it takes ~70 seconds to complete for me with 50k

/// Many bundles with a tight deadline. Verify block completes within time.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_load_deadline_pressure() {
let count = 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, we manage to include all 100 txs within the 500ms deadline. Maybe we should bump this to 1000 and at the end of the test also do

assert!(built.tx_count() < count, "expected not all txs to be executed");

balance: info.balance,
has_code: info.code_hash != trevm::revm::primitives::KECCAK_EMPTY,
}),
_ => Ok(AcctInfo { nonce: 0, balance: U256::ZERO, has_code: false }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to future-proof in case we change the error type:

Suggested change
_ => Ok(AcctInfo { nonce: 0, balance: U256::ZERO, has_code: false }),
Ok(None) => Ok(AcctInfo { nonce: 0, balance: U256::ZERO, has_code: false }),
Err(_) => unreachable!("error type is infallible"),

@Evalir
Copy link
Member

Evalir commented Mar 11, 2026

Update: It wasn't a deadlock, it was a very long running test from a runtime blow up. The blow up was caused by a priority fee collision at insertion time

This seems worth looking into?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants